;Place masonry fence linear symbol as anonymous block.
(DEFUN C:MASFEN ( )
(setq osmod (getvar"osmode"))
(setvar "osmode" 0)
  (setq begin "T")
  (IF dimscl nil (LOAD "dimscl" "\nFile DIMSCL.LSP not loaded! "))
  (if upoint nil (load"upoint" "\nFile UPOINT.LSP not loaded! "))
  (dimscl)
  (if (eq modf "EXST")
    (setq cirad (* dimsc 0.044))
    (setq cirad (* dimsc 0.066))
  );if
  (if (eq modf "EXST")
    (setq pt1 (upoint 0 "" "Existing Fence beginning point" nil nil))
    (setq pt1 (upoint 0 "" "Proposed Fence beginning point" nil nil))
  );if
  (entmake
    (list
      (cons 0 "BLOCK")
      (cons 70 1)
      (cons 2 "*U")
      (cons 10 (list 0 0 0))
    )
  )
  (while
    (setq pt2 (upoint 0 "" "Next fence point" nil pt1))
    (setq fenl (distance pt1 pt2)
          count (1+(fix(/ fenl (* dimsc 0.5))))
          cispc (/ fenl count)
    );setq
    (while
      (> count 0)
    (setq langl (angle pt1 pt2)
          lang2 (+ langl (* pi 0.25))
          lang3 (+ langl (* pi 0.75))
          pt3 (polar pt1 langl (* dimsc 0.0625))
          pt4 (polar pt1 langl cispc)
          pt5 (polar pt4 (+ langl pi) (* dimsc 0.0625))
          pt6 (polar pt4 lang2 cirad)
          pt7 (polar pt4 (+ pi lang2) cirad)
          pt8 (polar pt4 lang3 cirad)
          pt9 (polar pt4 (+ pi lang3) cirad)
          pt10 (polar pt8 langl (* 0.5 (distance pt6 pt8)))
          pt11 (polar pt7 langl (* 0.5 (distance pt6 pt8)))
          pta1 (polar pt1 lang2 cirad)
          pta2 (polar pt1 (+ pi lang2) cirad)
          pta3 (polar pt1 lang3 cirad)
          pta4 (polar pt1 (+ pi lang3) cirad)
          pta5 (polar pta3 langl (* 0.5 (distance pta1 pta3)))
          pta6 (polar pta2 langl (* 0.5 (distance pta1 pta3)))
    );setq
    (if begin
      (progn
    (entmake
      (list
        (cons 0 "LINE")
        (cons 10 pta1)
        (cons 11 pta3)
        (cons 8 "0")
      )
    )
    (entmake
      (list
        (cons 0 "LINE")
        (cons 10 pta4)
        (cons 11 pta2)
        (cons 8 "0")
      )
    )
    (entmake
      (list
        (cons 0 "LINE")
        (cons 10 pta5)
        (cons 11 pta6)
        (cons 8 "0")
      )
    )
        (grdraw pta1 pta1 7)
        (grdraw pta4 pta2 7)
        (grdraw pta5 pta6 7)
        (setq begin nil)
      );progn
    );if
    (entmake
      (list
        (cons 0 "LINE")
        (cons 10 pt3)
        (cons 11 pt5)
        (cons 8 "0")
      )
    )
        (grdraw pt3 pt5 7)
    (entmake
      (list
        (cons 0 "LINE")
        (cons 10 pt6)
        (cons 11 pt8)
        (cons 8 "0")
      )
    )
    (entmake
      (list
        (cons 0 "LINE")
        (cons 10 pt9)
        (cons 11 pt7)
        (cons 8 "0")
      )
    )
    (entmake
      (list
        (cons 0 "LINE")
        (cons 10 pt10)
        (cons 11 pt11)
        (cons 8 "0")
      )
    )
        (grdraw pt6 pt8 7)
        (grdraw pt9 pt7 7)
        (grdraw pt10 pt11 7)
    (setq pt1 pt4
          count (1- count)
    );setq
    );while
  );while
(setq nblk (entmake (list (cons 0 "endblk"))))
(princ (strcat "\nBlock "(if nblk nblk "NOT")" Made\n"))
  (entmake
    (list
      (cons 0 "INSERT")
      (cons 2 nblk)
      (cons 10 (list 0 0 0))
      (cons 8 (getvar"clayer"))
      (cons 70 1)
    )
  )
  (setvar "osmode" osmod)
  (princ)
);defun